import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import user from './modules/user'
import layout from './modules/layout'
import dialog from './modules/dialog.js'
import info from './modules/info.js'
import { mapState, mapGetters, mapMutations, mapActions, } from 'vuex'

Vue.use(Vuex)
// computed最外层无法访问this Vue实例对象
// Object.assign(Vue.prototype, {
//   mapState,
//   mapGetters,
//   mapMutations,
//   mapActions,
// })

const store = new Vuex.Store({
  /**
   * 字段
   * state 状态数据
   * getters 计算属性
   * mutations 更改状态的api
   * actions 异步调度分发更改状态
   * modules 模块化store 名称空间
   */
  modules: {
    user,
    layout,
    info,
    dialog,
  },
  getters
})

export default store
